//
//  testTableView.m
//  MeiJianApp
//
//  Created by 志刚杨 on 2017/11/8.
//  Copyright © 2017年 voidcat. All rights reserved.
//

#import "testTableView.h"
#import "BaseTableViewCell.h"
#import "GetTestRequestApi.h"
@interface testTableView ()<QMUITableViewDelegate,QMUITableViewDataSource>
@property(nonatomic, strong) NSArray *dataSoucre;
@property(nonatomic, strong) GetTestRequestApi *TestAPI;
@end

@implementation testTableView
{
     NSString * identifier;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self CreateUI];
    // Do any additional setup after loading the view.
    
    _TestAPI = [GetTestRequestApi new];
    _TestAPI.p1 = @"a";
    [_TestAPI startWithCompletionBlockWithSuccess:^(__kindof YTKBaseRequest * _Nonnull request) {
        
    } failure:^(__kindof YTKBaseRequest * _Nonnull request) {
        
    }];
}

- (void)CreateUI {
    self.title = ASLocalizedString(@"测试");
    identifier = @"cell";
    [self.tableView registerClass:[BaseTableViewCell class] forCellReuseIdentifier:identifier];
    [self.view addSubview:self.tableView];
    _dataSoucre = @[@{@"titleText":ASLocalizedString(@"测试")},@{@"titleText":ASLocalizedString(@"测试")},@{@"titleText":ASLocalizedString(@"测试")},@{@"titleText":ASLocalizedString(@"测试")},@{@"titleText":ASLocalizedString(@"测试")},@{@"titleText":ASLocalizedString(@"测试")}];

    
    QMUITextView *text = [[QMUITextView alloc] init];
    text.frame = CGRectMake(0, 0, 300, 300);
    [self.view addSubview:text];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    [self.tableView reloadData];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _dataSoucre.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 60;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *identifier = @"cell";
    BaseTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[BaseTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    cell.customDetailText = [_dataSoucre[indexPath.row] valueForKey:@"titleText"];

    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
